<!DOCTYPE html>
<html lang="en">
  <head>
    <title>RxSwift  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset="utf-8">
    <script src="js/jquery.min.js" defer></script>
    <script src="js/jazzy.js" defer></script>

    <script src="js/lunr.min.js" defer></script>
    <script src="js/typeahead.jquery.js" defer></script>
    <script src="js/jazzy.search.js" defer></script>
  </head>
  <body>


    <a title="RxSwift  Reference"></a>

    <header class="header">
      <p class="header-col header-col--primary">
        <a class="header-link" href="index.html">
          RxSwift 6.9.0 Docs
        </a>
         (95% documented)
      </p>

      <div class="header-col--secondary">
        <form role="search" action="search.json">
          <input type="text" placeholder="Search documentation" data-typeahead>
        </form>
      </div>

        <p class="header-col header-col--secondary">
          <a class="header-link" href="https://github.com/ReactiveX/RxSwift">
            <img class="header-icon" src="img/gh.png" alt="GitHub"/>
            View on GitHub
          </a>
        </p>

    </header>

    <p class="breadcrumbs">
      <a class="breadcrumb" href="index.html">RxSwift Reference</a>
      <img class="carat" src="img/carat.png" alt=""/>
      RxSwift  Reference
    </p>

    <div class="content-wrapper">
      <nav class="navigation">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="RxSwift.html">RxSwift</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/AnyObserver.html">AnyObserver</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/Binder.html">Binder</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/Cancelable.html">Cancelable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/ConnectableObservableType.html">ConnectableObservableType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/Disposable.html">Disposable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Enums/Event.html">Event</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/GroupedObservable.html">GroupedObservable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/ImmediateSchedulerType.html">ImmediateSchedulerType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/Observable.html">Observable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/ObservableConvertibleType.html">ObservableConvertibleType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/ObservableType.html">ObservableType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/ObserverType.html">ObserverType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/Reactive.html">Reactive</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/SchedulerType.html">SchedulerType</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="RxSwift%2FDisposables.html">RxSwift/Disposables</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/BooleanDisposable.html">BooleanDisposable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/CompositeDisposable.html">CompositeDisposable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/CompositeDisposable.html#/s:7RxSwift19CompositeDisposableC10DisposeKeyV">– DisposeKey</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/Disposables.html">Disposables</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/DisposeBag.html">DisposeBag</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/DisposeBag/DisposableBuilder.html">– DisposableBuilder</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/DisposeBag/DisposableBuilder.html">– DisposableBuilder</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="RxSwift%2FDisposables.html#/s:7RxSwift11DisposeBaseC">DisposeBase</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/RefCountDisposable.html">RefCountDisposable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/ScheduledDisposable.html">ScheduledDisposable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/SerialDisposable.html">SerialDisposable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/SingleAssignmentDisposable.html">SingleAssignmentDisposable</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="RxSwift%2FSchedulers.html">RxSwift/Schedulers</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/ConcurrentDispatchQueueScheduler.html">ConcurrentDispatchQueueScheduler</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/ConcurrentMainScheduler.html">ConcurrentMainScheduler</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/CurrentThreadScheduler.html">CurrentThreadScheduler</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/HistoricalScheduler.html">HistoricalScheduler</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/HistoricalSchedulerTimeConverter.html">HistoricalSchedulerTimeConverter</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/MainScheduler.html">MainScheduler</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/OperationQueueScheduler.html">OperationQueueScheduler</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/SerialDispatchQueueScheduler.html">SerialDispatchQueueScheduler</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/VirtualTimeConverterType.html">VirtualTimeConverterType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/VirtualTimeScheduler.html">VirtualTimeScheduler</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="RxSwift%2FSubjects.html">RxSwift/Subjects</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/AsyncSubject.html">AsyncSubject</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/BehaviorSubject.html">BehaviorSubject</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/PublishSubject.html">PublishSubject</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/ReplaySubject.html">ReplaySubject</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/SubjectType.html">SubjectType</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="RxSwift%2FTraits%2FInfallible.html">RxSwift/Traits/Infallible</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/Infallible.html">Infallible</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="RxSwift%2FTraits%2FPrimitiveSequence.html">RxSwift/Traits/PrimitiveSequence</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="RxSwift%2FTraits%2FPrimitiveSequence.html#/s:7RxSwift11Completablea">Completable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="RxSwift%2FTraits%2FPrimitiveSequence.html#/s:7RxSwift5Maybea">Maybe</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/PrimitiveSequence.html">PrimitiveSequence</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="RxSwift%2FTraits%2FPrimitiveSequence.html#/s:7RxSwift6Singlea">Single</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Other%20Classes.html">Other Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Classes/ConnectableObservable.html">ConnectableObservable</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Other%20Global%20Variables.html">Other Global Variables</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Global%20Variables.html#/s:7RxSwift29maxTailRecursiveSinkStackSizeSivp">maxTailRecursiveSinkStackSize</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Other%20Enums.html">Other Enumerations</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Enums/CompletableEvent.html">CompletableEvent</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Enums.html#/s:7RxSwift16CompletableTraitO">CompletableTrait</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Enums/Hooks.html">Hooks</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Enums/InfallibleEvent.html">InfallibleEvent</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Enums/MaybeEvent.html">MaybeEvent</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Enums.html#/s:7RxSwift10MaybeTraitO">MaybeTrait</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Enums/RxError.html">RxError</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Enums.html#/s:7RxSwift11SingleTraitO">SingleTrait</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Enums/SubjectLifetimeScope.html">SubjectLifetimeScope</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Enums/TakeBehavior.html">TakeBehavior</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Enums/VirtualTimeComparison.html">VirtualTimeComparison</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Other%20Extensions.html">Other Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Extensions/AsyncSequence.html">AsyncSequence</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Extensions.html#/s:10Foundation11JSONDecoderC">JSONDecoder</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Extensions.html#/c:objc(cs)NSObject">NSObject</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Extensions.html#/s:10Foundation19PropertyListDecoderC">PropertyListDecoder</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Other%20Protocols.html">Other Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/DataDecoder.html">DataDecoder</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/EventConvertible.html">EventConvertible</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/InfallibleType.html">InfallibleType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/PrimitiveSequenceType.html">PrimitiveSequenceType</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Protocols/ReactiveCompatible.html">ReactiveCompatible</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Other%20Structs.html">Other Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Structs/Resources.html">Resources</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a class="nav-group-name-link" href="Other%20Typealiases.html">Other Type Aliases</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Typealiases.html#/s:7RxSwift0A15AbstractIntegera">RxAbstractInteger</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Typealiases.html#/s:7RxSwift0A10Observablea">RxObservable</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Typealiases.html#/s:7RxSwift0A4Timea">RxTime</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Typealiases.html#/s:7RxSwift0A12TimeIntervala">RxTimeInterval</a>
              </li>
              <li class="nav-group-task">
                <a class="nav-group-task-link" href="Other%20Typealiases.html#/s:7RxSwift11SingleEventa">SingleEvent</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">

        <section class="section">
          <div class="section-content top-matter">

            <p align="center">
<img src="https://github.com/ReactiveX/RxSwift/blob/main/assets/RxSwift_Logo.png?raw=true" width="35%" alt="RxSwift Logo" />
<br />
<a href="https://actions-badge.atrox.dev/ReactiveX/RxSwift/goto" target="_blank"><img src="https://github.com/ReactiveX/RxSwift/workflows/RxSwift/badge.svg?branch=main" alt="Build Status" /></a>
<img src="https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-333333.svg" alt="Supported Platforms: iOS, macOS, tvOS, watchOS & Linux" />
<br />
<a href="https://cocoapods.org/pods/RxSwift" alt="RxSwift on CocoaPods" title="RxSwift on CocoaPods"><img src="https://img.shields.io/cocoapods/v/RxSwift.svg" /></a>
<a href="https://github.com/Carthage/Carthage" alt="RxSwift on Carthage" title="RxSwift on Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" /></a>
<a href="https://github.com/swiftlang/swift-package-manager" alt="RxSwift on Swift Package Manager" title="RxSwift on Swift Package Manager"><img src="https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg" /></a>
</p>

<p>Rx is a <a href="https://youtu.be/looJcaeboBY">generic abstraction of computation</a> expressed through <code><a href="Classes/Observable.html">Observable&lt;Element&gt;</a></code> interface, which lets you broadcast and subscribe to values and other events from an <code><a href="Classes/Observable.html">Observable</a></code> stream.  </p>

<p>RxSwift is the Swift-specific implementation of the <a href="http://reactivex.io">Reactive Extensions</a> standard.</p>

<p align="center"><img src="https://github.com/ReactiveX/RxSwift/blob/main/assets/example.png?raw=true" width="55%" alt="RxSwift Observable Example of a price constantly changing and updating the app's UI" /></p>

<p>While this version aims to stay true to the original spirit and naming conventions of Rx, this project also aims to provide a true Swift-first API for Rx APIs.</p>

<p>Cross platform documentation can be found on <a href="http://reactivex.io/">ReactiveX.io</a>.</p>

<p>Like other Rx implementations, RxSwift&rsquo;s intention is to enable easy composition of asynchronous operations and streams of data in the form of <code><a href="Classes/Observable.html">Observable</a></code> objects and a suite of methods to transform and compose these pieces of asynchronous work.</p>

<p>KVO observation, async operations, UI Events and other streams of data are all unified under <a href="Documentation/GettingStarted.md#observables-aka-sequences">abstraction of sequence</a>. This is the reason why Rx is so simple, elegant and powerful.</p>
<h2 id='i-came-here-because-i-want-to' class='heading'>I came here because I want to &hellip;</h2>
<h6 id='understand' class='heading'>&hellip; understand</h6>

<ul>
<li><a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Why.md">why use rx?</a></li>
<li><a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/GettingStarted.md">the basics, getting started with RxSwift</a></li>
<li><a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Traits.md">traits</a> - what are <code><a href="RxSwift%2FTraits%2FPrimitiveSequence.html#/s:7RxSwift6Singlea">Single</a></code>, <code><a href="RxSwift%2FTraits%2FPrimitiveSequence.html#/s:7RxSwift11Completablea">Completable</a></code>, <code><a href="RxSwift%2FTraits%2FPrimitiveSequence.html#/s:7RxSwift5Maybea">Maybe</a></code>, <code>Driver</code>, and <code>ControlProperty</code> &hellip; and why do they exist?</li>
<li><a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/UnitTests.md">testing</a></li>
<li><a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Tips.md">tips and common errors</a></li>
<li><a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/GettingStarted.md#debugging">debugging</a></li>
<li><a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/MathBehindRx.md">the math behind Rx</a></li>
<li><a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/HotAndColdObservables.md">what are hot and cold observable sequences?</a></li>
</ul>
<h6 id='install' class='heading'>&hellip; install</h6>

<ul>
<li>Integrate RxSwift/RxCocoa with my app. <a href="#installation">Installation Guide</a></li>
</ul>
<h6 id='hack-around' class='heading'>&hellip; hack around</h6>

<ul>
<li>with the example app. <a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/ExampleApp.md">Running Example App</a></li>
<li>with operators in playgrounds. <a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Playgrounds.md">Playgrounds</a></li>
</ul>
<h6 id='interact' class='heading'>&hellip; interact</h6>

<ul>
<li>All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br /><a href="http://slack.rxswift.org">Join Slack Channel</a></li>
<li>Report a problem using the library. <a href="https://github.com/ReactiveX/RxSwift/blob/main/.github/ISSUE_TEMPLATE.md">Open an Issue With Bug Template</a></li>
<li>Request a new feature. <a href="Documentation/NewFeatureRequestTemplate.md">Open an Issue With Feature Request Template</a></li>
<li>Help out <a href="https://github.com/ReactiveX/RxSwift/blob/main/CONTRIBUTING.md">Check out contribution guide</a></li>
</ul>
<h6 id='compare' class='heading'>&hellip; compare</h6>

<ul>
<li><a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/ComparisonWithOtherLibraries.md">with Combine and ReactiveSwift</a>.</li>
</ul>
<h6 id='understand-the-structure' class='heading'>&hellip; understand the structure</h6>

<p>RxSwift is as compositional as the asynchronous work it drives. The core unit is RxSwift itself, while other dependencies can be added for UI Work, testing, and more.</p>

<p>It comprises five separate components depending on each other in the following way:</p>
<pre class="highlight plaintext"><code>┌──────────────┐    ┌──────────────┐
│   RxCocoa    ├────▶   RxRelay    │
└───────┬──────┘    └──────┬───────┘
        │                  │
┌───────▼──────────────────▼───────┐
│             RxSwift              │
└───────▲──────────────────▲───────┘
        │                  │
┌───────┴──────┐    ┌──────┴───────┐
│    RxTest    │    │  RxBlocking  │
└──────────────┘    └──────────────┘
</code></pre>

<ul>
<li><strong>RxSwift</strong>: The core of RxSwift, providing the Rx standard as (mostly) defined by <a href="https://reactivex.io">ReactiveX</a>. It has no other dependencies.</li>
<li><strong>RxCocoa</strong>: Provides Cocoa-specific capabilities for general iOS/macOS/watchOS &amp; tvOS app development, such as Shared Sequences, Traits, and much more. It depends on both <code>RxSwift</code> and <code>RxRelay</code>.</li>
<li><strong>RxRelay</strong>: Provides <code>PublishRelay</code>, <code>BehaviorRelay</code> and <code>ReplayRelay</code>, three <a href="https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Subjects.md#relays">simple wrappers around Subjects</a>. It depends on <code>RxSwift</code>.</li>
<li><strong>RxTest</strong> and <strong>RxBlocking</strong>: Provides testing capabilities for Rx-based systems. It depends on <code>RxSwift</code>.</li>
</ul>
<h2 id='usage' class='heading'>Usage</h2>

<table>
  <tr>
    <th width="30%">Here&rsquo;s an example</th>
    <th width="30%">In Action</th>
  </tr>
  <tr>
    <td>Define search for GitHub repositories &hellip;</td>
    <th rowspan="9"><img src="https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/GithubSearch.gif"></th>
  </tr>
  <tr>
    <td><div class="highlight highlight-source-swift"><pre>
let searchResults = searchBar.rx.text.orEmpty
    .throttle(.milliseconds(300), scheduler: MainScheduler.instance)
    .distinctUntilChanged()
    .flatMapLatest { query -> Observable&lt;[Repository]&gt; in
        if query.isEmpty {
            return .just([])
        }
        return searchGitHub(query)
            .catchAndReturn([])
    }
    .observe(on: MainScheduler.instance)</pre></div></td>
  </tr>
  <tr>
    <td>&hellip; then bind the results to your tableview</td>
  </tr>
  <tr>
    <td width="30%"><div class="highlight highlight-source-swift"><pre>
searchResults
    .bind(to: tableView.rx.items(cellIdentifier: "Cell")) {
        (index, repository: Repository, cell) in
        cell.textLabel?.text = repository.name
        cell.detailTextLabel?.text = repository.url
    }
    .disposed(by: disposeBag)</pre></div></td>
  </tr>
</table>
<h2 id='installation' class='heading'>Installation</h2>

<p>RxSwift doesn&rsquo;t contain any external dependencies.</p>

<p>These are currently the supported installation options:</p>
<h3 id='manual' class='heading'>Manual</h3>

<p>Open Rx.xcworkspace, choose <code>RxExample</code> and hit run. This method will build everything and run the sample app</p>
<h3 id='a-href-https-guides-cocoapods-org-using-using-cocoapods-html-cocoapods-a' class='heading'><a href="https://guides.cocoapods.org/using/using-cocoapods.html">CocoaPods</a></h3>
<pre class="highlight ruby"><code><span class="c1"># Podfile</span>
<span class="n">use_frameworks!</span>

<span class="n">target</span> <span class="s1">'YOUR_TARGET_NAME'</span> <span class="k">do</span>
    <span class="n">pod</span> <span class="s1">'RxSwift'</span><span class="p">,</span> <span class="s1">'6.9.0'</span>
    <span class="n">pod</span> <span class="s1">'RxCocoa'</span><span class="p">,</span> <span class="s1">'6.9.0'</span>
<span class="k">end</span>

<span class="c1"># RxTest and RxBlocking make the most sense in the context of unit/integration tests</span>
<span class="n">target</span> <span class="s1">'YOUR_TESTING_TARGET'</span> <span class="k">do</span>
    <span class="n">pod</span> <span class="s1">'RxBlocking'</span><span class="p">,</span> <span class="s1">'6.9.0'</span>
    <span class="n">pod</span> <span class="s1">'RxTest'</span><span class="p">,</span> <span class="s1">'6.9.0'</span>
<span class="k">end</span>
</code></pre>

<p>Replace <code>YOUR_TARGET_NAME</code> and then, in the <code>Podfile</code> directory, type:</p>
<pre class="highlight shell"><code><span class="nv">$ </span>pod <span class="nb">install</span>
</code></pre>
<h3 id='xcframeworks' class='heading'>XCFrameworks</h3>

<p>Each release starting with RxSwift 6 includes <code>*.xcframework</code> framework binaries.</p>

<p>Simply drag the needed framework binaries to your <strong>Frameworks, Libraries, and Embedded Content</strong> section under your target&rsquo;s <strong>General</strong> tab.</p>

<p><img src="https://raw.githubusercontent.com/ReactiveX/RxSwift/main/assets/xcframeworks.png" alt="XCFrameworks instructions" width="65%"></p>

<blockquote>
<p>[!TIP]
You may verify the identity of the binaries by comparing against the following fingerprint in Xcode 15+:</p>

<p><code>BD 80 2E 79 4C 8A BD DA 4C 3F 5D 92 B3 E4 C4 FB FA E4 73 44 10 B9 AD 73 44 2E F1 CE B0 27 61 40</code></p>

<p><img src="https://raw.githubusercontent.com/ReactiveX/RxSwift/main/assets/xcframeworks_signing.png" alt="XCFrameworks Signature Fingerprint in Xcode 15+" width="65%"></p>
</blockquote>
<h3 id='a-href-https-github-com-carthage-carthage-carthage-a' class='heading'><a href="https://github.com/Carthage/Carthage">Carthage</a></h3>

<p>Add this to <code>Cartfile</code></p>
<pre class="highlight plaintext"><code>github "ReactiveX/RxSwift" "6.9.0"
</code></pre>
<pre class="highlight shell"><code><span class="nv">$ </span>carthage update
</code></pre>
<h4 id='carthage-as-a-static-library' class='heading'>Carthage as a Static Library</h4>

<p>Carthage defaults to building RxSwift as a Dynamic Library. </p>

<p>If you wish to build RxSwift as a Static Library using Carthage you may use the script below to manually modify the framework type before building with Carthage:</p>
<pre class="highlight shell"><code>carthage update RxSwift <span class="nt">--platform</span> iOS <span class="nt">--no-build</span>
<span class="nb">sed</span> <span class="nt">-i</span> <span class="nt">-e</span> <span class="s1">'s/MACH_O_TYPE = mh_dylib/MACH_O_TYPE = staticlib/g'</span> Carthage/Checkouts/RxSwift/Rx.xcodeproj/project.pbxproj
carthage build RxSwift <span class="nt">--platform</span> iOS
</code></pre>
<h3 id='a-href-https-github-com-swiftlang-swift-package-manager-swift-package-manager-a' class='heading'><a href="https://github.com/swiftlang/swift-package-manager">Swift Package Manager</a></h3>

<blockquote>
<p><strong>Note</strong>: There is a critical cross-dependency bug affecting many projects including RxSwift in Swift Package Manager. We&rsquo;ve <a href="https://bugs.swift.org/browse/SR-12303">filed a bug (SR-12303)</a> in early 2020 but have no answer yet. Your mileage may vary. A partial workaround can be found <a href="https://github.com/ReactiveX/RxSwift/issues/2127#issuecomment-717830502">here</a>.</p>
</blockquote>

<p>Create a <code>Package.swift</code> file.</p>
<pre class="highlight swift"><code><span class="c1">// swift-tools-version:5.0</span>

<span class="kd">import</span> <span class="kt">PackageDescription</span>

<span class="k">let</span> <span class="nv">package</span> <span class="o">=</span> <span class="kt">Package</span><span class="p">(</span>
  <span class="nv">name</span><span class="p">:</span> <span class="s">"RxProject"</span><span class="p">,</span>
  <span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span>
    <span class="o">.</span><span class="nf">package</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="s">"https://github.com/ReactiveX/RxSwift.git"</span><span class="p">,</span> <span class="o">.</span><span class="nf">upToNextMajor</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="s">"6.0.0"</span><span class="p">))</span>
  <span class="p">],</span>
  <span class="nv">targets</span><span class="p">:</span> <span class="p">[</span>
    <span class="o">.</span><span class="nf">target</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"RxProject"</span><span class="p">,</span> <span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span><span class="s">"RxSwift"</span><span class="p">,</span> <span class="o">.</span><span class="nf">product</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"RxCocoa"</span><span class="p">,</span> <span class="nv">package</span><span class="p">:</span> <span class="s">"RxSwift"</span><span class="p">)]),</span>
  <span class="p">]</span>
<span class="p">)</span>
</code></pre>
<pre class="highlight shell"><code><span class="nv">$ </span>swift build
</code></pre>

<p>To build or test a module with RxTest dependency, set <code>TEST=1</code>.</p>
<pre class="highlight shell"><code><span class="nv">$ TEST</span><span class="o">=</span>1 swift <span class="nb">test</span>
</code></pre>
<h3 id='manually-using-git-submodules' class='heading'>Manually using git submodules</h3>

<ul>
<li>Add RxSwift as a submodule</li>
</ul>
<pre class="highlight shell"><code><span class="nv">$ </span>git submodule add git@github.com:ReactiveX/RxSwift.git
</code></pre>

<ul>
<li>Drag <code>Rx.xcodeproj</code> into Project Navigator</li>
<li>Go to <code>Project &gt; Targets &gt; Build Phases &gt; Link Binary With Libraries</code>, click <code>+</code> and select <code>RxSwift</code>, <code>RxCocoa</code> and <code>RxRelay</code> targets</li>
</ul>
<h2 id='references' class='heading'>References</h2>

<ul>
<li><a href="http://reactivex.io/">http://reactivex.io/</a></li>
<li><a href="https://github.com/Reactive-Extensions">Reactive Extensions GitHub (GitHub)</a></li>
<li><a href="https://store.raywenderlich.com/products/rxswift-reactive-programming-with-swift">RxSwift RayWenderlich.com Book</a></li>
<li><a href="https://www.youtube.com/watch?v=GdvLP0ZAhhc">RxSwift: Debunking the myth of hard (YouTube)</a></li>
<li><a href="https://boxueio.com/series/rxswift-101">Boxue.io RxSwift Online Course</a> (Chinese 🇨🇳)</li>
<li><a href="https://youtu.be/looJcaeboBY">Expert to Expert: Brian Beckman and Erik Meijer - Inside the .NET Reactive Framework (Rx) (video)</a></li>
<li><a href="https://youtu.be/-8Y1-lE6NSA">Reactive Programming Overview (Jafar Husain from Netflix)</a></li>
<li><a href="http://csl.stanford.edu/%7Echristos/pldi2010.fit/meijer.duality.pdf">Subject/Observer is Dual to Iterator (paper)</a></li>
<li><a href="http://rxmarbles.com/">Rx standard sequence operators visualized (visualization tool)</a></li>
<li><a href="https://www.haskell.org/">Haskell</a></li>
</ul>

          </div>
        </section>


      </article>
    </div>
    <section class="footer">
      <p>&copy; 2024 <a class="link" href="https://github.com/ReactiveX/RxSwift" target="_blank" rel="external noopener">Shai Mishali and Krunoslav Zaher</a>. All rights reserved. (Last updated: 2024-10-06)</p>
      <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.4</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
    </section>
  </body>
</html>
